//
//  NSString+Size.m
//  自适应
//
//  Created by zhangxiang on 16/6/27.
//  Copyright © 2016年 zhangxiang. All rights reserved.
//

#import "NSString+Size.h"

@implementation NSString (Size)

+ (CGSize)textString:(NSString *)text fontSize:(CGFloat)fontSize maxWidth:(CGFloat)maxWidth{
       CGRect rect = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil];//计算text的大小
    return rect.size;
}

@end
